Xbasic
Array append Method
Syntax
N result = <array>.append([count as N])
Arguments
- countNumeric
The number of entries to append. Default value is 1.
Returns
- resultNumeric
Returns the index of the first entry appended to the array.
Description
Append one or more empty entries to the end of an array. Returns index of first appended entry.
Discussion
The <array>.append() method for an Xbasic array appends one or more empty entries to the end of the array. <array>.append() returns the index of the first entry created.
Example
dim arr[3] as c arr[1] = "apple" arr[2] = "banana" arr[3] = "orange" dim index as n index = arr.append(2) arr[index] = "pear" arr[index+1] = "mango" ? arr = [1] = "apple" [2] = "banana" [3] = "orange" [4] = "pear" [5] = "mango"